package com.ziyun.erp.modules.userTeam.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.ziyun.erp.modules.userTeam.dao.UserDistributionDao;
import com.ziyun.erp.modules.userTeam.entity.UserDistributionEntity;
import com.ziyun.erp.modules.userTeam.service.UserDistributionService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;
import io.renren.common.utils.R;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;


@Service("userDistributionService")
public class UserDistributionServiceImpl extends ServiceImpl<UserDistributionDao, UserDistributionEntity> implements UserDistributionService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        Page<UserDistributionEntity> page = this.selectPage(
                new Query<UserDistributionEntity>(params).getPage(),
                new EntityWrapper<UserDistributionEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public R leaveTeam(Integer teamId) {
         this.baseMapper.leaveTeam(teamId);
        return R.ok();
    }

    @Override
    public List<String> checkUserDistribution(String[] phoneList) {
        return this.baseMapper.checkUserDistribution(phoneList);
    }

}
